package com.vvv.designpattern.ordermanagement.command.command;

import com.vvv.designpattern.ordermanagement.command.receiver.OrderCommandReceiver;
import com.vvv.designpattern.pojo.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author vvv
 * @date 2023-11-22 08 47
 * discription命令模式：具体命令角色，与命令接受者进行关联，调用命令接受者的方法
 * 当然，具体命令角色也可以创建多个和接收者角色对应
 */
@Component
public class OrderCommand implements OrderCommandInterface{

    /**
     * 命令角色需要去关联接受者角色
     */
    @Resource
    private OrderCommandReceiver orderCommandReceiver;

    @Override
    public void execute(Order order) {
        orderCommandReceiver.action(order);
    }
}
